import type BasePanelService from "./base/service";
import DefaultService from "./default/service";
import FlowService from "./flow/service";
import ModelService from "./model/service";
import StartService from "./start/service";
import UserTask from "./task/user";

// 各不同类型面板的服务
const panelServices: Record<string, new () => BasePanelService> = {
  // 流程配置
  'bpmn:Process': ModelService,
  // 开始节点
  'bpmn:StartEvent': StartService,
  // 任务节点
  // 'bpmn:Task': TaskService,
  // "bpmn:ServiceTask": TaskService,
  "bpmn:UserTask": UserTask,
  // "bpmn:BusinessRuleTask": TaskService,
  // "bpmn:ScriptTask": TaskService,
  // "bpmn:ReceiveTask": TaskService,
  // "bpmn:ManualTask": TaskService,
  // 流程连线
  'bpmn:SequenceFlow': FlowService,
  // 网关
  'bpmn:ExclusiveGateway': DefaultService,
  'bpmn:InclusiveGateway': DefaultService,
  'bpmn:ParallelGateway': DefaultService,
  // 'bpmn:EventBasedGateway': DefaultService,
};

export const getPanelServiceByType = (type: string): undefined | (new () => BasePanelService) => {
  if (panelServices[type]) {
    return panelServices[type];
  }

  // eslint-disable-next-line no-console
  console.warn('getPanelServiceByType', type, 'not found');
  return DefaultService;
};